<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            box-sizing: border-box;
        }
        body {
            background-color: #ccc;
        }

        .box,
        .out,
        .box>div {
            width: 300px;
            height: 300px;
        }
        .out {
            margin: 200px auto 0;
            animation: d 5s infinite linear;
            transform-style: preserve-3d;
        }
        @keyframes d {
            0% {
                transform: rotateY(0)
            }
            100% {
                transform: rotateY(360deg)
            }
        }
        .box {
            position: relative;
            transform-style: preserve-3d;
            transform:rotateZ(45deg) rotateX(45deg);
            perspective: 0px;
        }

        .box>div {
            position: absolute;
            top: 0;
            left: 0;
            display: flex;
            opacity: 1;
            background-size: cover;
            background-position: center center;
            transition: all 500ms cubic-bezier(0.9, -0.95, 0.21, 2);
            box-shadow: 0 0 10px 5px #fff;
        }

        .one {
            transform: translateZ(150px);
            background-image: url('./images/1.jfif');
        }

        .two {
            transform: rotateY(180deg) translateZ(150px);
            background-image: url('./images/2.jfif');
        }

        .three {
            transform: rotateY(-90deg) translateZ(150px);
            background-image: url('./images/3.jfif');
        }

        .four {
            transform: rotateY(90deg) translateZ(150px);
            background-image: url('./images/4.jfif');
        }

        .five {
            transform: rotateX(90deg) translateZ(150px);
            background-image: url('./images/5.jfif');
        }

        .six {
            transform: rotateX(-90deg) translateZ(150px);
            background-image: url('./images/6.jfif');
        }

        .box:hover .one {
            transform: translateZ(300px);
        }

        .box:hover .two {
            transform: rotateY(180deg) translateZ(300px);
        }

        .box:hover .three {
            transform: rotateY(-90deg) translateZ(300px);
        }

        .box:hover .four {
            transform: rotateY(90deg) translateZ(300px);
        }

        .box:hover .five {
            transform: rotateX(90deg) translateZ(300px);
        }

        .box:hover .six {
            transform: rotateX(-90deg) translateZ(300px);
        }
    </style>
</head>

<body>
    <div class="out">
        <div class="box">
            <div class="one">
            </div>
            <div class="two">
            </div>
            <div class="three">
            </div>
            <div class="four">
            </div>
            <div class="five">
            </div>
            <div class="six">
            </div>
        </div>
    </div>
</body>
</html>